<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<jsp:include page="/WEB-INF/backstage/util.jsp" />
</head>
<body>
	<center>
		 <form class="form-inline" id="form" method="post" action="${pageContext.request.contextPath }/wsyactive/selectBis_coupon_active">
			  <button style="background:#1E90FF; font-weight: bold;font-size: 15px" class=" glyphicon glyphicon-plus  btn-sm" data-toggle="modal" type="button" onclick="add()">新增</button>
			  <div class="form-group">
			     活动名称：<input type="text" class="form-control" id="active_name" name="active_name" >
			  </div>
			  <div class="form-group">
			     删除标志：<select class="form-control" name="is_del" id="is_del">
					  <option value="-1" >--未选择--</option>
					  <option value="0">有效</option>
					  <option value="1">删除</option>
					</select>
			  </div>
			  <div class="form-group">
			     <button style="background:#1E90FF; font-weight: bold;font-size: 15px" type="submit" class="glyphicon glyphicon-search btn-sm">查询</button>
			  </div>
			  <div class="form-group">
			    <button style="background:#1E90FF; font-weight: bold;font-size: 15px" type="reset" class="glyphicon glyphicon-refresh btn-sm" >重置</button></div>
			  </div>
		 </form>
		 <form action="" method="post" id="form" style="font-weight: bold;font-size: 15px">
		 <!-- 查询所有 -->
			<table class="table table-hover" border="1">
				<tr>
					<td></td>
					<td>活动名称</td>
					<td>颜值券数量</td>
					<td>每张券可兑换颜值数量  </td>
					<td>已兑换数量  </td>
					<td>剩余数量  </td>
					<td>删除标志  </td>
					<td>创建时间</td>
					<td>操作</td>
				</tr>
				<c:forEach items="${activeList }" var="a" varStatus="statu">
					<tr>
						<td>${statu.index+1 }</td>
						<td>${a.active_name }</td>
						<td>${a.beauty_num }</td>
						<td>${a.bond_num }</td>
						<td>${a.exchangeNumber }</td>
						<td>${a.residueNumber }</td>
						<td>${a.is_del=='0'?'有效':'已删除' }</td>
						<td>${a.create_time }</td>
						<td>
							<button style="background:#1E90FF; font-weight: bold;font-size: 15px" class="glyphicon glyphicon-search" type="button" onclick="selectBis_coupon_record(${a.active_id})">查看礼券兑换码信息</button>
							<c:if test="${a.is_del!=1}">
								<button style="background:#1E90FF; font-weight: bold;font-size: 15px" type="button" onclick="del(${a.active_id})">删除</button>
							</c:if>
						</td>
					</tr>
				</c:forEach>
			</table>
			<!-- 查询所有结束 -->
		  </form>
		<!-- Modal -->
		<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
		  <div class="modal-dialog">
		    <div class="modal-content">
		      <div class="modal-header">
		        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
		        <h4 align="left" class="modal-title" id="myModalLabel" style="font-weight: bolder">新增活动礼券信息</h4>
		      </div>
		      <div class="modal-body">
		       <form action="${pageContext.request.contextPath }/wsyactive/insertBis_coupon_active" method="post" id="Myform" class="form-horizontal">
		       	<div class="form-group">
				    <label for="inputEmail3" class="col-sm-4 control-label">活动名称：</label>
				    <div class="col-sm-8">
				      <input type ="text"  class="form-control" id="active_name" name="active_name" >
					</div>
			    </div></br></br>
			    
			    <div class="form-group">
				    <label for="inputEmail3" class="col-sm-4 control-label">用户姓名：</label>
				    <div class="col-sm-8">
				      <select name="mobile" id="mobile">
				      <c:forEach items="${custom_user }" var="ss">
				      <option value="${ss.mobile}">${ss.username}</option>
				      </c:forEach>
				      </select>
					</div>
			    </div></br></br>
			    
			 	<div class="form-group">
				    <label for="inputEmail3" class="col-sm-4 control-label">美妍券数量：</label>
				    <div class="col-sm-6">
				      <input type ="number" min="0" max="10000000" class="form-control" id="beauty_num" name="beauty_num" >
					</div>
					<label for="inputEmail3" class="col-sm-2 control-label">张券</label>
			    </div></br></br>
			    <div class="form-group">
				    <label for="inputEmail3" class="col-sm-4 control-label">每张可兑换颜值数量：</label>
				    <div class="col-sm-6">
				      <input type ="number" min="0" max="10000000" class="form-control" id="bond_num" name="bond_num" value="${BBC.give_num }">
				    </div>
				    <label for="inputEmail3" class="col-sm-2 control-label">个币</label>
			    </div></br></br>
		      </div>
		      <div class="modal-footer">
		        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
		        <button type="submit" class="btn btn-primary" >生成美研卷</button>
		      </div>
		     </form>
		    </div>
		  </div>
		</div>
		<!-- 添加模态框结束 -->
	</center>
</body>

<script type="text/javascript">
	//查看礼券兑换码信息
	function selectBis_coupon_record(active_id){
		form.action="${pageContext.request.contextPath }/wsyactive/selectBis_coupon_record?active_id="+active_id;
		form.submit();
	}
	//删除
	function del(active_id){
		if(window.confirm("你确定要删除该颜值基本设置信息吗 ？")){
			form.action="${pageContext.request.contextPath }/wsyactive/deleteBis_coupon_active?active_id="+active_id; 
			form.submit();
		}
	} 
	//添加
	function add(){
		$("#myModal").modal("show");
	}
</script>
</html>

